package com.wiiss.mock.service.impl;

import com.wiiss.common.utils.DateUtils;
import com.wiiss.mock.domain.MockServer;
import com.wiiss.mock.mapper.MockServerMapper;
import com.wiiss.mock.service.IMockServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 模拟服务Service业务层处理
 *
 * @author my
 * @date 2021-10-18
 */
@Service
public class MockServerServiceImpl implements IMockServerService {
    @Autowired
    private MockServerMapper mockServerMapper;

    /**
     * 查询模拟服务
     *
     * @param id 模拟服务ID
     * @return 模拟服务
     */
    @Override
    public MockServer selectMockServerById(Long id) {
        return mockServerMapper.selectMockServerById(id);
    }

    /**
     * 查询模拟服务列表
     *
     * @param mockServer 模拟服务
     * @return 模拟服务
     */
    @Override
    public List<MockServer> selectMockServerList(MockServer mockServer) {
        return mockServerMapper.selectMockServerList(mockServer);
    }

    /**
     * 新增模拟服务
     *
     * @param mockServer 模拟服务
     * @return 结果
     */
    @Override
    public int insertMockServer(MockServer mockServer) {
        mockServer.setCreateTime(DateUtils.getNowDate());
        mockServer.setUpdateTime(DateUtils.getNowDate());
        return mockServerMapper.insertMockServer(mockServer);
    }

    /**
     * 修改模拟服务
     *
     * @param mockServer 模拟服务
     * @return 结果
     */
    @Override
    public int updateMockServer(MockServer mockServer) {
        mockServer.setUpdateTime(DateUtils.getNowDate());
        return mockServerMapper.updateMockServer(mockServer);
    }

    /**
     * 批量删除模拟服务
     *
     * @param ids 需要删除的模拟服务ID
     * @return 结果
     */
    @Override
    public int deleteMockServerByIds(Long[] ids) {
        return mockServerMapper.deleteMockServerByIds(ids);
    }

    /**
     * 删除模拟服务信息
     *
     * @param id 模拟服务ID
     * @return 结果
     */
    @Override
    public int deleteMockServerById(Long id) {
        return mockServerMapper.deleteMockServerById(id);
    }
}
